//
//  App6CityBlock.m
//  DeyiLife
//
//  Created by zxin on 16/7/30.
//  Copyright © 2016年 Deyi. All rights reserved.
//

#import "MarketPaimaiBlock.h"

@implementation MarketPaimaiBlock

- (id)init{
    self = [super init];
    if(self)
    {
        self.backgroundColor = [UIColor whiteColor];
        self.img = [UIImageView new];
        [self addSubview:_img];
        [_img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).with.offset((ScreenWidth - 109 * 3) / 4);
            make.top.equalTo(self.mas_top);
            make.height.mas_equalTo(109);
            make.width.mas_equalTo(109);
        }];
        _img.layer.masksToBounds = YES;
//        _img.layer.cornerRadius = 4.f;
        
        self.price = [UILabel new];
        [self addSubview:_price];
        _price.font = [FontTool fontWithSize:13];
        _price.textColor = [UIColor redColor];
        _price.textAlignment = NSTextAlignmentCenter;
        [_price mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(_img.mas_bottom).with.offset(0);
            make.left.equalTo(_img.mas_left).with.offset(0);
            make.width.mas_equalTo(109);
            make.height.mas_equalTo(20);
        }];
        
        NSString *changeStr = @"当前价: ¥244.00";
        NSString *subStr = @"当前价: ";
        NSRange range = [changeStr rangeOfString:subStr];
        NSMutableAttributedString *strAttribute = [[NSMutableAttributedString alloc] initWithString:changeStr];
        [strAttribute addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:range];
        [strAttribute addAttribute:NSFontAttributeName value:[FontTool fontWithSize:11] range:range];
        _price.attributedText = strAttribute;
        
        self.timeline = [UILabel new];
        [self addSubview:_timeline];
        _timeline.text = @"";//@"距结束: 06:07:35";
        _timeline.font = [FontTool fontWithSize:12];
        _timeline.textColor = [UIColor whiteColor];
        _timeline.textAlignment = NSTextAlignmentCenter;
        [_timeline mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(_img.mas_bottom).with.offset(0);
            make.left.equalTo(_img.mas_left).with.offset(0);
            make.width.mas_equalTo(109);
            make.height.mas_equalTo(20);
        }];
    }
    return self;
}

@end
